<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 暴力解法 时间：O(n ^ 2) 空间O(1)
        function twoSum(numbers, target) {
            for (let i = 0; i < numbers.length; i++) {
                for (let j = i + 1; j < numbers.length; j++) {
                    if (numbers[i] + numbers[j] === target) {
                        return [i, j]
                    }
                }
            }
        }
        console.log(twoSum([2, 3, 4], 6));
    </script>
</body>

</html>